package org.electronic.registration.dao;

import org.electronic.registration.bo.Doctor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * User: Egor
 * Date: 26.11.11
 */
@Service
public class DoctorDaoImpl extends BaseDao implements DoctorDao {


    public void save(Doctor doctor) {
        getHibernateTemplate().save(doctor);
    }

    public List<Doctor> getAllDoctors() {
        return getHibernateTemplate().findByNamedQuery(Doctor.GET_ALL_DOCTORS);
    }

    public Doctor getDoctorByName(String name) {
        return (Doctor) getHibernateTemplate().findByNamedQuery(Doctor.GET_DOCTOR_BY_NAME, name).get(0);
    }
}

